package o;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import com.huawei.appgallery.forum.base.card.bean.Section;
import com.huawei.appgallery.forum.cards.node.ForumHorizonListNode;
import com.huawei.appgallery.forum.forum.node.ForumFollowListNodeV2;
import com.huawei.appgallery.forum.forum.node.ForumHorizonNode;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.secure.android.common.intent.SafeBroadcastReceiver;
import java.util.List;

public class bur extends chl {
    public static final String ˋ = (bqy.ˋ().ˏ().getPackageName() + ".forum.section.recentaccess.action");
    public static final String ॱ = (bqy.ˋ().ˏ().getPackageName() + ".forum.section.follow.action");
    private bva ˊॱ = null;
    private buw ˏ = null;
    private buy ˏॱ = null;
    private SafeBroadcastReceiver ॱˊ = new SafeBroadcastReceiver(this) {
        final /* synthetic */ bur ˎ;

        {
            this.ˎ = r1;
        }

        public void onReceiveMsg(Context context, Intent intent) {
            if (intent != null) {
                String action = intent.getAction();
                Section section;
                if (bur.ॱ.equals(action)) {
                    section = (Section) intent.getSerializableExtra("section");
                    if (section != null) {
                        this.ˎ.ˋ(section);
                        this.ˎ.ॱ(section);
                    }
                } else if (bur.ˋ.equals(action)) {
                    section = (Section) intent.getSerializableExtra("section");
                    if (section != null) {
                        this.ˎ.ˎ(section);
                    }
                }
            }
        }
    };

    public bur(Context context) {
        super(context);
        try {
            IntentFilter intentFilter = new IntentFilter(ॱ);
            intentFilter.addAction(ˋ);
            ll.ˏ(context).ˏ(this.ॱˊ, intentFilter);
        } catch (Throwable e) {
            bqx.ˊ("ForumHomeProvider", "register error", e);
        }
    }

    public chz ॱ(long j, int i, int i2, List<CardBean> list, String str) {
        cie ˋ = cib.ˋ(this.ʼ, i);
        if (ˋ == null) {
            return null;
        }
        chz o_chz;
        if (ˋ instanceof ForumFollowListNodeV2) {
            this.ˏ = new buw(j, ˋ, i2, list);
            o_chz = this.ˏ;
        } else if (ˋ instanceof ForumHorizonNode) {
            this.ˊॱ = new bva(j, ˋ, i2, list);
            o_chz = this.ˊॱ;
        } else if (ˋ instanceof ForumHorizonListNode) {
            this.ˏॱ = new buy(j, ˋ, i2, list);
            o_chz = this.ˏॱ;
        } else {
            o_chz = new chz(j, ˋ, i2, list);
        }
        int i3 = this.ͺ;
        this.ͺ = i3 + 1;
        o_chz.ˊ(i3);
        o_chz.ˏ(str);
        this.ॱॱ.add(o_chz);
        return o_chz;
    }

    public void ˋ(Section section) {
        if (this.ˏ != null) {
            this.ˏ.ˊ(section);
            ͺ();
        }
    }

    public void ˎ(Section section) {
        if (this.ˊॱ != null) {
            this.ˊॱ.ˏ(section);
            ͺ();
        }
    }

    public void ॱ(Section section) {
        if (this.ˏॱ != null) {
            this.ˏॱ.ˎ(section);
            ͺ();
        }
    }

    public void ॱ() {
        try {
            ll.ˏ(bqy.ˋ().ˏ()).ˋ(this.ॱˊ);
        } catch (Throwable e) {
            bqx.ˊ("ForumHomeProvider", "unregister error", e);
        }
    }
}
